﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MedicalLog.Domain.Entities;

namespace MedicalLog.Domain.Repositories
{
    public class LabTestsRepository
    {
        MedicalLogEntities _dbMedicalLog;

        public LabTestsRepository()
        {
            _dbMedicalLog = new MedicalLogEntities();
        }

        public void AddLabTests(LabTest labTest)
        {
            _dbMedicalLog.LabTests.AddObject(labTest);
            _dbMedicalLog.SaveChanges();
        }

        public void DeleteLabTests(LabTest labTest)
        {
            _dbMedicalLog.LabTests.DeleteObject(labTest);
            _dbMedicalLog.SaveChanges();
        }

        public LabTest getLabTest(int id)
        {
            return _dbMedicalLog.LabTests.First(x => x.Id == id);
        }

        public IQueryable<LabTest> getLabTests()
        {
            return _dbMedicalLog.LabTests.Select(x => x);
        }

    }
}
